package avicit.bdp.dms.tdm.utils;

import avicit.bdp.core.enums.BaseEnum;

public enum CheckerStatus implements BaseEnum {
  WAIT_PUBLISH(0, "未提交"),
  WAIT_PUBLISH_APPROVE(1,"待审批"),
  WAIT_REVOKE_APPROVE(2, "撤回待审批"),
  APPROVED(3, "审批通过"),
  REVOKE_APPROVED(4, "审批拿回"),
  NOT_APPROVED(5, "审批不通过");

  CheckerStatus(int code, String descp) {
    this.code = code;
    this.descp = descp;
  }

  private final int code;
  private final String descp;

  public static CheckerStatus valueOf(int value) {
    for (CheckerStatus approveStatus : values()) {
      if (approveStatus.getCode() == value) {
        return approveStatus;
      }
    }
    return null;
  }

  public static String getDescByCode(Integer code) {
    if (code != null) {
      CheckerStatus[] values = CheckerStatus.values();
      for (CheckerStatus obj : values) {
        if (obj.getCode() == code) {
          return obj.getDescp();
        }
      }
    }

    return null;
  }

  public int getCode() {
    return code;
  }

  public String getDescp() {
    return descp;
  }

}
